import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../pages/home.vue'
import Index from '../pages/index'
// import Login from '../pages/login'
// import Product from '../pages/product'
// import Detail from '../pages/detail'
// import Cart from '../pages/cart'
// import Order from '../pages/order'
// import OrderConfirm from '../pages/orderConfirm'
// import OrderList from '../pages/orderList'
// import OrderPay from '../pages/orderPay'
// import Alipay from '../pages/alipay'

Vue.use(VueRouter)

const routes = [
  {
    redirect:'/index',
    path: '/',
    name: 'Home',
    component: Home,
    children: [
      {
        path: '/index',
        name: 'index',
        component: Index
      },
      {
        path: '/product/:id',
        name: 'product',
        component: ()=>import('./../pages/product.vue')
      },
      {
        path: '/detail/:id',
        name: 'detail',
        component: ()=>{import('./../pages/detail.vue')}
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: ()=>import('./../pages/login.vue')
  },
  {
    path: '/cart',
    name: 'cart',
    component: ()=>import('./../pages/cart.vue')
  },
  {
    path: '/order',
    name: 'order',
    component: ()=>import('./../pages/order.vue'),
    children: [
      {
        path: 'confirm',
        name: 'order-confirm',
        component:()=>import('./../pages/orderConfirm.vue')
      },
      {
        path:'list',
        name:'order-list',
        component:()=>import('./../pages/orderList.vue')
      },
      {
        path:'pay',
        name:'order-pay',
        component:()=>import('./../pages/orderPay.vue')
      },
      {
        path:'alipay',
        name:'alipay',
        component:()=>import('./../pages/alipay.vue')
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
